﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Galoap
{
    partial class Game
    {

        /// <summary>
        /// method which returns a document that in this game is not used yet
        /// </summary>
        /// <typeparam name="T">the type of the document required</typeparam>
        /// <returns>the document required</returns>
        virtual public Document GetUnusedDocument<T>() where T : Document
        {
            List<Document> docs = GetDocuments();
            foreach (Document d in GaloapDatabase.Database.Document.OfType<T>())
                if (!docs.Contains(d))
                    return d;
            throw new InvalidOperationException("No more unused documents on Database.");
        }
    }
}
